#ifndef QPROCESSTASK_H
#define QPROCESSTASK_H

#include <QJsonObject>
#include <QProcess>

class QProcessTask : public QProcess
{
    Q_OBJECT
public:
    QProcessTask(QJsonObject task, QObject* parent = nullptr);
    virtual ~QProcessTask();

    QJsonObject task() const;

Q_SIGNALS:
    void taskFinished(int, QProcess::ExitStatus);
    void SIG_heart(QString task_id);

public Q_SLOTS:
    void SLT_CancelTask(QString task_id);

protected:
    QJsonObject m_task;

    // QObject interface
protected:
    virtual void timerEvent(QTimerEvent *event) override;
};

#endif // QPROCESSTASK_H
